#include "XiLianOkDialog.h"
#include "../../../model/proxy/ItemProxy.h"
#include "../../../net/NetController.h"

XiLianOkDialog::XiLianOkDialog(void)
	:mNeedGold(NULL)
{
}

XiLianOkDialog::~XiLianOkDialog(void)
{
	CC_SAFE_RELEASE(mNeedGold);
}

bool XiLianOkDialog::init()
{
	return true;
}

SEL_MenuHandler XiLianOkDialog::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName )
{
	return NULL;
}

SEL_CCControlHandler XiLianOkDialog::onResolveCCBCCControlSelector( CCObject * pTarget, CCString * pSelectorName )
{
	CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onOkBtnClick", XiLianOkDialog::onOkBtnClick);
	CCB_SELECTORRESOLVER_CCCONTROL_GLUE(this, "onCanselBtnClick", XiLianOkDialog::onCanselBtnClick);
	return NULL;
}

bool XiLianOkDialog::onAssignCCBMemberVariable( CCObject * pTarget, CCString * pMemberVariableName, CCNode * pNode )
{
	CCB_MEMBERVARIABLEASSIGNER_GLUE(this, "mNeedGold", CCLabelTTF *, this->mNeedGold);
	return false;
}

void XiLianOkDialog::onNodeLoaded( CCNode * pNode, CCNodeLoader * pNodeLoader )
{

}

void XiLianOkDialog::onEnter()
{
	ModelDialog::onEnter();
}

void XiLianOkDialog::onExit()
{
	ModelDialog::onExit();
}

void XiLianOkDialog::refresh()
{
	mNeedGold->setString(itos(100));
}

void XiLianOkDialog::_onNotification( CCObject* object )
{
	
}

void XiLianOkDialog::onDoItClick(CCObject* pSender)
{
    
}

void XiLianOkDialog::onOkBtnClick( CCObject * pSender, CCControlEvent pCCControlEvent )
{
	EquipInfo* equipInfo = (EquipInfo*)mData;
	NetController::getSingletonPtr()->resetEquipage(equipInfo->index);
	close();
}

void XiLianOkDialog::onCanselBtnClick( CCObject * pSender, CCControlEvent pCCControlEvent )
{
	close();
}
